function isValid()
{
    var res="true";
    if(!checkUserFirsName())
    {
        if(res.toString()=="true")res="";
        res+='User first name must be at least 5 letters <br>';
    }
    if(!checkUserLastName())
    {
        if(res.toString()=="true")res="";
        res+='User last name must be at least 5 letters <br>';
    }
    if(!checkUserAge())
    {
        if(res.toString()=="true")res="";
        res+='User age must be a digit <br>';
    }

    return res;
}

function checkUserFirsName()
{
return  ($('fname').value.toString().length<5)?false:true;
}
function checkUserLastName()
{
return ($('lname').value.toString().length<5)?false:true;
}
function checkUserAge()
{
return isDigit($('age').value);
}

function isDigit(str)
{
    var allowedChars = "0123456789";     //  For Checking Decimal , allowedChars = "0123456789.";
    var isDigit=str.length>0;

    var char;
    for (i = 0; i  < str.length && isDigit == true; i++)
    {
        char = str.charAt(i);
        if (allowedChars.indexOf(char) == -1)  isDigit = false;
    }
    return isDigit;

}

